package elective;

import java.util.Arrays;
import java.util.Random;

/** 冒泡排序 */
public class Demo01 {
    public static void main(String[] args) {
        Random random=new Random();
        int[] array=new int[10];
        for (int i = 0; i <array.length ; i++) {
            array[i]=random.nextInt(100);
        }
        System.out.println(Arrays.toString(array));//
        System.out.println();
        for (int i = 0; i <array.length ; i++) {
            for (int j = 1; j <array.length ; j++) {
                if(array[j]<array[j-1]){
                    int temp=array[j];
                    array[j]=array[j-1];
                    array[j-1]=temp;
                } System.out.println(Arrays.toString(array));
            }System.out.println();
        }
    }
}
